/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author GilJSA
 */
@Entity
@Table(name = "cmarco")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cmarco.findAll", query = "SELECT c FROM Cmarco c"),
    @NamedQuery(name = "Cmarco.findByIdMarco", query = "SELECT c FROM Cmarco c WHERE c.idMarco = :idMarco")})
public class Cmarco implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idMarco")
    private Integer idMarco;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cMarcoidMarco")
    private Collection<Convenios> conveniosCollection;

    public Cmarco() {
    }

    public Cmarco(Integer idMarco) {
        this.idMarco = idMarco;
    }

    public Integer getIdMarco() {
        return idMarco;
    }

    public void setIdMarco(Integer idMarco) {
        this.idMarco = idMarco;
    }

    @XmlTransient
    public Collection<Convenios> getConveniosCollection() {
        return conveniosCollection;
    }

    public void setConveniosCollection(Collection<Convenios> conveniosCollection) {
        this.conveniosCollection = conveniosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMarco != null ? idMarco.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cmarco)) {
            return false;
        }
        Cmarco other = (Cmarco) object;
        if ((this.idMarco == null && other.idMarco != null) || (this.idMarco != null && !this.idMarco.equals(other.idMarco))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Cmarco[ idMarco=" + idMarco + " ]";
    }
    
}
